﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="DuyetSanPham.aspx.cs" Inherits="DuyetSanPham" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 284px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        <br />
        <asp:GridView ID="GridView_SanPham" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
            DataKeyNames="ID" DataSourceID="SqlDataSource_SanPham" ForeColor="#333333" 
            GridLines="None" onselectedindexchanged="GridView_SanPham_SelectedIndexChanged">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                <asp:BoundField DataField="ID" HeaderText="Mã SP" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="TenSanPham" HeaderText="Tên SP" 
                    SortExpression="TenSanPham" />
                <asp:BoundField DataField="GiaBanHienTai" HeaderText="Giá Bán" 
                    SortExpression="GiaBanHienTai" />
                <asp:ImageField DataImageUrlField="HinhSanPham" 
                    DataImageUrlFormatString="~/Image/{0}" HeaderText="Hình Minh Họa">
                    <ControlStyle Height="50px" Width="50px" />
                </asp:ImageField>
                <asp:BoundField DataField="DoUuTien" HeaderText="Độ Ưu Tiên" 
                    SortExpression="DoUuTien" />
                <asp:BoundField DataField="SoLuotXem" HeaderText="Số Lượt Xem" 
                    SortExpression="SoLuotXem" />
                <asp:BoundField DataField="SoLuotMua" HeaderText="Số Lượt Mua" 
                    SortExpression="SoLuotMua" />
                <asp:BoundField DataField="TenHangSanXuat" HeaderText="Hãng Sản Xuất" 
                    SortExpression="TenHangSanXuat" />
                <asp:BoundField DataField="TenGianHang" HeaderText="Tên Gian Hàng" 
                    SortExpression="TenGianHang" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
    </p>
    <p>
    </p>
    <p>
    </p>
    <table class="style1">
        <tr>
            <td class="style2">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Label ID="Label7" runat="server" Text="Mã Sản Phẩm"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td>
                <asp:Label ID="Label8" runat="server" Text="Tên Sản Phẩm "></asp:Label>
            </td>
            <td>
                <asp:Label ID="Label9" runat="server" Text="Duyệt"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style2">
                <asp:TextBox ID="txt_masp" runat="server" Enabled="False" Width="55px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="txt_tensp" runat="server" Enabled="False"></asp:TextBox>
            </td>
            <td>
                <asp:CheckBox ID="checkbox_duyet" runat="server" />
            </td>
        </tr>
    </table>
    <p>
    </p>
    <p>
    </p>
    <p>
    </p>
    <p>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Đồng Ý" />
    </p>
    <p>
        &nbsp;</p>
    <p>
        <asp:Label ID="kq" runat="server" Font-Size="Medium" ForeColor="#0000CC" 
            Text="Label"></asp:Label>
    </p>
    <p>
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource_SanPham" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            DeleteCommand="DELETE FROM [SAN_PHAM] WHERE [ID] = @ID" 
            InsertCommand="INSERT INTO [SAN_PHAM] ([MaDanhMucSanPham], [TenSanPham], [GiaBanHienTai], [HinhSanPham], [DoUuTien], [MaHangSanXuat], [SoLuotXem], [SoLuotMua]) VALUES (@MaDanhMucSanPham, @TenSanPham, @GiaBanHienTai, @HinhSanPham, @DoUuTien, @MaHangSanXuat, @SoLuotXem, @SoLuotMua)" 
            SelectCommand="SELECT SAN_PHAM.ID, SAN_PHAM.TenSanPham, SAN_PHAM.GiaBanHienTai, SAN_PHAM.HinhSanPham, SAN_PHAM.DoUuTien, SAN_PHAM.MaHangSanXuat, SAN_PHAM.SoLuotXem, SAN_PHAM.SoLuotMua, HANG_SAN_XUAT.TenHangSanXuat, GIAN_HANG.TenGianHang FROM SAN_PHAM INNER JOIN HANG_SAN_XUAT ON SAN_PHAM.ID = HANG_SAN_XUAT.ID INNER JOIN SAN_PHAM_THUONG_DANG_BAN_TREN_GIAN_HANG ON SAN_PHAM.ID = SAN_PHAM_THUONG_DANG_BAN_TREN_GIAN_HANG.ID INNER JOIN GIAN_HANG ON SAN_PHAM.ID = GIAN_HANG.ID" 
            UpdateCommand="UPDATE [SAN_PHAM] SET [MaDanhMucSanPham] = @MaDanhMucSanPham, [TenSanPham] = @TenSanPham, [GiaBanHienTai] = @GiaBanHienTai, [HinhSanPham] = @HinhSanPham, [DoUuTien] = @DoUuTien, [MaHangSanXuat] = @MaHangSanXuat, [SoLuotXem] = @SoLuotXem, [SoLuotMua] = @SoLuotMua WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="MaDanhMucSanPham" Type="Int32" />
                <asp:Parameter Name="TenSanPham" Type="String" />
                <asp:Parameter Name="GiaBanHienTai" Type="Int64" />
                <asp:Parameter Name="HinhSanPham" Type="String" />
                <asp:Parameter Name="DoUuTien" Type="Int32" />
                <asp:Parameter Name="MaHangSanXuat" Type="Int32" />
                <asp:Parameter Name="SoLuotXem" Type="Int32" />
                <asp:Parameter Name="SoLuotMua" Type="Int32" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="MaDanhMucSanPham" Type="Int32" />
                <asp:Parameter Name="TenSanPham" Type="String" />
                <asp:Parameter Name="GiaBanHienTai" Type="Int64" />
                <asp:Parameter Name="HinhSanPham" Type="String" />
                <asp:Parameter Name="DoUuTien" Type="Int32" />
                <asp:Parameter Name="MaHangSanXuat" Type="Int32" />
                <asp:Parameter Name="SoLuotXem" Type="Int32" />
                <asp:Parameter Name="SoLuotMua" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
    </p>
    <p>
    </p>
</asp:Content>

